I think the more important question is "why does JavaScript have both a substr method and a substring method"? This is really the preferred ... ... <看更多>
indexOf() returns the index of the first occurrence of substring ( substr ) in a string ( str ):. let index = str.indexOf(substr, [, fromIndex]);. ... <看更多>